#ifndef __KERNEL_C__
#define __KERNEL_C__
#include "port.h"
#include "task.h"

#if HOOKS_ENABLED
#include "hooks.h"
#endif

#define IDLE_TASK_PRIO 0


#define ENTER_CRITICAL() enterCritical()
#define EXIT_CRITICAL()  exitCritical()

#define IntEnter() interruptEnter()
#define IntExit() interruptExit()


extern uint_32 criticalNesting;

static __inline void enterCritical()
{
	if (!criticalNesting)
		DISABLE_INTERRUPTS();
	criticalNesting++; 
}

static __inline void exitCritical(){
	if (--criticalNesting == 0)
			ENABLE_INTERRUPTS();
}


void interruptEnter(void);
void interruptExit(void);
void uKern_Init(void);
void StartOS(void);
void IdleTask(void *args);
void idleTaskInit(void);
#endif
